/**
 *
 * @description:
 * @author:junyong.hong
 * @createTime:2018/3/4
 * @version:1.0.0.0
 * @history:
 *    1、
 *    2、
 *
 */
import Vue from 'vue'

// const es6的赋值方法
const state = {
  orderList: [],
  params: {}
}

const getters = {
  getOrderList: state => state.orderList
  // 对以下进行简写
  // orderList: function () {
  //   return state.orderList
  // }
}

const actions = {
  fetchOrderList ({ commit, state }) {
    Vue.http.post('/api/getOrderList', state.params)
      .then((res) => {
        commit('updateOrderList', res.data.list)
      }, (err) => {

      })
  }
}

const mutations = {
  updateOrderList (state, payload) {
    state.orderList = payload
  }
}
export default {
  state,
  getters,
  actions,
  mutations
}
